#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int gvar=2;
int main(void)
{
  pid_t pid;
int var=5;
printf("process id :%ld \n",(long)getpid());
printf("gvar=%d\tvar=%d\n",gvar,var);
if((pid=vfork())<0)
{
printf("error\n");
return 1;
}
else if(pid==0)
{
gvar--; var++;
printf("the child  process id :%ld\t gvar=%d\t var=%d\n",(long)getpid(),gvar,var);
_exit(0);
}
else
{
printf("the parent process id:%ld\t gavr=%d\t var=%d\n",(long)getpid(),gvar,var);
return 0;
}
}
